class Gun:

    def __init__(self,model):
        self.model = model
        self.bullet_count = 0

    def add_bullet(self,count):
        self.bullet_count += count

    def shoot(self):
        if self.bullet_count <=0:
            print('[%s] 没子弹了......' % self.model)
            return
        self.bullet_count -=1

        print('[%s] 突突突...... [%d]' % (self.model, self.bullet_count))

ak47 = Gun('AK47')

class Solider:
    def __init__(self, name):
        self.name = name
        self.gun = None

    def fire(self):
        if self.gun is None:
            return
        self.gun.add_bullet(90)

        self.gun.shoot()



xusanduo = Solider('许三多')
xusanduo.gun = ak47
xusanduo.fire()




